<template>
    <view class="diy-live">
        <view class="item" v-for="(item, index) in dataList" :key="index">
            <navigator class="room" :url="'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.roomid + '&custom_params=' + item.roomid">
                <view class="img"><image :src="item.cover_img"></image></view>
                <view class="info">
                    <view class="detail">
                        <view class="in">
                            <text class="label">主题</text>
                            :
                            <text class="title">{{ item.name }}</text>
                        </view>
                        <view class="in">
                            <text class="label">主播</text>
                            :{{ item.anchor_name }}
                        </view>
                        <view class="in" v-if="item.timeInfo">
                            <text class="label">开播:</text>
                            :{{ item.timeInfo }}
                        </view>
                        <view class="in">
                            <text class="label">时间:</text>
                            <text class="time-set">{{ item.timeSet }}</text>
                        </view>
                        <view class="in">
                            <text class="label">状态:</text>
                            {{ item.status }}
                        </view>
                    </view>
                </view>
                <view class="clear"></view>
            </navigator>
        </view>
    </view>
</template>

<script>
const app = getApp();
export default {
    data() {
        return {
            dataList: []
        };
    },
    onLoad: function (options) {
        let that = this;
        app.globalData._post_form('live/get_rooms', {}, function (result) {
            console.log('liveRet', result);
            if (result.code == 1) {
                that.setData({
                    dataList: result.data.data
                });
                if (result.data.code == -1) {
                    uni.showModal({
                        title: '温馨提示',
                        content: result.data.msg,
                        complete: (res) => {
                            //回到首页
                            uni.navigateBack();
                        }
                    });
                }
            }
        });
    },
    methods: {}
};
</script>
<style>
@import './live.css';
</style>
